<?php
namespace Mouta\AmistateBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use FOS\UserBundle\Entity\User as BaseUser;
use Symfony\Component\Validator\Constraints as Assert;
use Mouta\AmistateBundle\utils\Strings;
use Symfony\Component\Security\Core\User\UserInterface;

/**
 * Mouta\AmistateBundle\Entity
 * 
 * @ORM\Table(name="asunto")
 * @ORM\Entity(repositoryClass="Mouta\AmistateBundle\Entity\AsuntoRepository")
 */
class Asunto
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    protected $id;

    /**
     * @ORM\Column(type="string")
     * @Assert\NotBlank()
     */
    protected $asunto;
    
    /**
     * @ORM\Column(type="datetime")
     * @Assert\DateTime()
     * @Assert\NotBlank()
     */
    protected $created_at;
    
    /**
     * @ORM\ManyToOne(targetEntity="Usuario")
     * @ORM\JoinColumn(name="created_by", referencedColumnName="id", onDelete="Cascade")
     */
    protected $created_by;
    
    /**
     * @ORM\OneToMany(targetEntity="Mensaje", mappedBy="asunto")
     */
    protected $mensajes;

    public function __construct()
    {
        $this->mensajes = new \Doctrine\Common\Collections\ArrayCollection();
        $this->created_at = new \DateTime();
    }
    
    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set asunto
     *
     * @param string $asunto
     */
    public function setAsunto($asunto)
    {
        $this->asunto = $asunto;
    }

    /**
     * Get asunto
     *
     * @return string 
     */
    public function getAsunto()
    {
        return $this->asunto;
    }

    /**
     * Set created_at
     *
     * @param datetime $createdAt
     */
    public function setCreatedAt($createdAt)
    {
        $this->created_at = $createdAt;
    }

    /**
     * Get created_at
     *
     * @return datetime 
     */
    public function getCreatedAt()
    {
        return $this->created_at;
    }

    /**
     * Set created_by
     *
     * @param Mouta\AmistateBundle\Entity\Usuario $createdBy
     */
    public function setCreatedBy(\Mouta\AmistateBundle\Entity\Usuario $createdBy)
    {
        $this->created_by = $createdBy;
    }

    /**
     * Get created_by
     *
     * @return Mouta\AmistateBundle\Entity\Usuario 
     */
    public function getCreatedBy()
    {
        return $this->created_by;
    }

    /**
     * Add mensajes
     *
     * @param Mouta\AmistateBundle\Entity\Mensaje $mensajes
     */
    public function addMensaje(\Mouta\AmistateBundle\Entity\Mensaje $mensajes)
    {
        $this->mensajes[] = $mensajes;
    }

    /**
     * Get mensajes
     *
     * @return Doctrine\Common\Collections\Collection 
     */
    public function getMensajes()
    {
        return $this->mensajes;
    }

}